package com.bit.demo.springioc;

import com.bit.demo.springioc.component.UserComponent;
import com.bit.demo.springioc.controller.HController;
import com.bit.demo.springioc.controller.MyController;
import com.bit.demo.springioc.model.Student;
import com.bit.demo.springioc.rep.UserRepository;
import com.bit.demo.springioc.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SpringIocApplication {

    public static void main(String[] args) {
        ApplicationContext context= SpringApplication.run(SpringIocApplication.class, args);
//        MyController bean= context.getBean(MyController.class);
//        bean.sayHello();
//
//        MyController bean2= (MyController) context.getBean("myController");
//        bean2.sayHello();
//
//        MyController bean3= context.getBean("myController", MyController.class);
//       bean3.sayHello();
//        HController bean8= context.getBean("aaa", HController.class);
//        bean8.sayHello();
//
//        UserService bean4= context.getBean(UserService.class);
//        bean4.sayHello();
//        UserRepository bean5= context.getBean(UserRepository.class);
//        bean5.sayHello();
//        MyController bean6= context.getBean(MyController.class);
//        bean6.sayHello();
//        UserComponent bean7= context.getBean(UserComponent.class);
//        bean7.sayHello();

        Student bean=(Student) context.getBean("s1");
        System.out.println(bean);


    }

}
